home *** CD-ROM | disk | FTP | other *** search
/ Level 2005 Christmas (DVD) / Level_2005-XMAS_134_DVD_Knightshift.iso / Demos / Ski Racing 2006 / setup1.cab / DataCommonShadersDX8Normal_Specular_Basic.psh < prev    next >
Encoding:
Text File  |  2005-11-03  |  973 b   |  43 lines

  1. ;Light the skin with a directional lights and a bump map.
  2. ;
  3. ;B  = Base map
  4. ;N  = Per pixel normal from normal map
  5. ;D1 = Light 1 Direction in t2
  6. ;C1 = Light 1 Color in c2
  7. ;AL = Ambient lighting in oD0
  8. ;MC = Material color in oD1
  9. ;Oc = Output color
  10. ;Oa = Output alpha
  11. ;
  12. ;Oc = B * MC * (((N dot D1) * C1) + ((N dot D2) * C2))
  13. ;Oa = 1
  14.  
  15. ps.1.1
  16.  
  17. def c0, 1.0, 1.0, 1.0, 1.0
  18.  
  19. tex  t0                      ;Sample base map
  20. tex  t1                      ;Sample normal map
  21. tex  t2                      ;Sample gloss map
  22.  
  23.  
  24. dp3_sat r1, t1_bx2, v1_bx2        ;half vector dot normal
  25.  
  26. ; exp specular
  27. mul r1, r1, r1
  28. mul r1, r1, r1
  29.  
  30. ; modulate gloss
  31. mul_sat r1, t2, r1 
  32.  
  33.  
  34. ; N dot L.  Both vectors are biased coming out of the vertex shader.
  35. dp3_sat r0, t1_bx2, v0_bx2   ;N dot L for Light1 - normal shading
  36. mad_sat r0, r0, c2, c1      ;Color for Light1 C3 = dircolor + C2 = ambcolor 
  37.  
  38.  
  39. ; add specular component
  40.  
  41. mad_sat r0.rgb, r0, t0, r1
  42. +mov r0.a, c3
  43.